package cn.bigfire.wzdj.util;

public class Console {


    public static String where(int num) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < num; i++) {
            int level = i + 1;
            final StackTraceElement stackTraceElement = new Throwable().getStackTrace()[level];
            final String className = stackTraceElement.getClassName();
            final String methodName = stackTraceElement.getMethodName();
            final String fileName = stackTraceElement.getFileName();
            final Integer lineNumber = stackTraceElement.getLineNumber();
            if (level==num){
                sb.append(String.format("%s.%s(%s:%s)", className, methodName, fileName, lineNumber));
            }
//            sb.append("\n");
        }
        return sb.toString();
    }

}
